#include "app_buffer.h"
#include "log/log.h"

int main(int argc, char const *argv[])
{
    // 初始化Buffer
    Buffer *buf = app_buffer_init(15);

    // 向Buffer中写入数据
    app_buffer_write(buf, "hello", 5);
    app_buffer_write(buf, "world", 5);

    // 从Buffer中读取数据
    char read_buf1[15];
    int buf_len1 = app_buffer_read(buf, read_buf1, 5);
    log_debug("read_buf1: %.*s, buf_len: %d", buf_len1, read_buf1, buf_len1);

    char read_buf2[15];
    int buf_len2 = app_buffer_read(buf, read_buf2, 5);
    log_debug("read_buf2: %.*s, buf_len: %d", buf_len2, read_buf2, buf_len2);

    // 销毁Buffer
    app_buffer_free(buf);

    return 0;
}
